<script>
    $(document).ready(function(){


        $("ul.sf-menu").superfish({
                    delay:       1000,                            // one second delay on mouseout
                    animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation
                    speed:       'fast',                          // faster animation speed
                    autoArrows:  false,                           // disable generation of arrow mark-up
                    dropShadows: false                            // disable drop shadows
                }
        );
    });
</script>
<?php
$rs=getPortalMenu("null","ASC");
?>
<div  id="navigation">
    <ul class="sf-menu sf-js-enabled sf-shadow">
        <?php
        while ( !$rs->EOF)  {
            if (canView("portal_pages",$rs->fields["id"])) {
                $selected="";
                if ($rs->fields["name"]==getParameter("pageName")) $selected=" class='current-menu-item' ";
                ?>

                <li <?php echo $selected; ?> >

 <span class="navigation">
  <a href="<?php echo createNiceUrl("pageName",$rs->fields["name"])?>">
      <?php if ($rs->fields["logo_file"]!="") { ?>
      <img src="<?php echo $rs->fields["logo_file"]; ?>">
      <?php } else { ?>
      <?php echo $rs->fields["title"]; ?>
      <?php }  ?>
  </a></span>
                    <?php

                    $rschild=getPortalMenu($rs->fields["id"],"ASC");
                    $hasChilds=false;

                    //echo "<script>alert('".$rschild->EOF."');</script>";
                    if (!$rschild->EOF){
                        $hasChilds=true;
                        ?>
<ul class="child" >
<?php
                    }
                    ?>
                    <?php
                    while ( !$rschild->EOF)  {
                        if (canView("portal_pages",$rschild->fields["id"])) {
                            ?>
                            <li>
                                <a href="<?php echo createNiceUrl("pageName",$rschild->fields["name"])?>"><?php echo $rschild->fields["title"]; ?></a> </li>
                            <?php
                        }
                        $rschild->MoveNext();
                    }
                    if ($hasChilds){
                        ?>
</ul>
<?php
                    }
                    ?>
                </li>
                <?php
            }

            $rs->MoveNext();
        }
        ?>
    </ul>
</div>
 
